package com.beiding.sqlbuilder.impl;

import com.beiding.sqlbuilder.FunType;
import com.beiding.sqlbuilder.Table;

public class SimpleTable implements Table {

    private String name;

    private String alias;

    SimpleTable() {
    }

    public SimpleTableField $(String name) {
        return new SimpleTableField(this, name);
    }

    public SimpleTableField $all() {
        return new SimpleTableField(this, "*");
    }

    public SimpleTableField $count(String name) {
        return $(name).fun(FunType.Count);
    }

    public SimpleTable(String name) {
        this.name = name;
    }

    public SimpleTable(String name, String alias) {
        this.name = name;
        this.alias = alias;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getAlias() {
        return alias;
    }
}
